﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Sharp.DataTransferObject;
using Sharp.Platform;
using Sharp.Platform.List;
using Sharp.Platform.Other;

namespace Sharp.WebBooter.Areas.Platform.Models
{
    [Title("组织结构管理")]
    [DataHandler(ModuleOP.Details, "浏览", 0)]
    [DataHandler(ModuleOP.Create, "新增", 1)]
    [DataHandler(ModuleOP.Edit, "修改", 2)]
    [DataHandler(ModuleOP.Delete, "删除", 3)]
    [DataHandler(ModuleOP.Refresh, "刷新", 4)]
    public class OrgIndexViewModel : SharpTreeList
    {
        public OrgIndexViewModel()
        {
            this.Feature = ListFeature.MultiSelect;
        }
        /// <summary>
        /// Id
        /// </summary>
        public System.Guid Id { get; set; }
        /// <summary>
        /// 上级
        /// </summary>
        public System.Guid? ParentId { get; set; }
        /// <summary>
        /// 编码
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int OrderIndex
        {
            get;
            set;
        }
        /// <summary>
        /// 名称
        /// </summary>
        /// <value>标题</value>
        [TemplateColumn(Width = 160, Text = "名称", SearchFor = true, TemplateString = "<a class=\"auto\" data-toggle=\"ajaxLoad\" href=\"@Url.Action(\"Edit\")/@item.Id\">@item.Title</a>")]
        public string Title { get; set; }
        /// <summary>
        /// 简称
        /// </summary>
        public string Abbreviation { get; set; }
        /// <summary>
        /// 层次Id
        /// </summary>
        public Guid? OrgLevelId { get; set; }

        /// <summary>
        /// 编制
        /// </summary>
        public int? MaxHeadcount { get; set; }

        /// <summary>
        /// 当前编制
        /// </summary>
        [Display(Name = "当前编制")]
        public int? CurrentHeadcount { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        /// <value>备注</value>
        [Column(Text = "备注")]
        public string Remark { get; set; }

        /// <summary>
        /// 层次
        /// </summary>
        [Display(Name = "层次")]
        public OrgLevelDTO OrgLevel { get; set; }

        /// <summary>
        /// 组织路径
        /// </summary>
        /// <value>The org path.</value>
        public string OrgPath { get; set; }

        /// <summary>
        /// 为控件显示用的属性
        /// </summary>
        /// <![CDATA[<treegrid-@Model.Id treegrid-parent-@Model.ParentId>]]>
        public string Itemclass { get; set; }

        public List<OrgIndexViewModel> Data { get; set; }
    }
}